package com.wzx.controller;

import com.wzx.common.Result;
import com.wzx.pojo.User;
import com.wzx.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @Transactional
    @PostMapping("/login")
    public Result userLogin(@RequestBody User user){
        log.info("user:{}",user);
        return userService.login(user);
    }


    @Transactional
    @GetMapping("/loginOut")
    public Result userLoginOut(){
        return userService.loginOut();
    }


}
